import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';

export const FormColumns = (self, dict) => [
  {
    title: '名称',
    name: 'name',
    tableItem: {},
    formItem: {  //   新增或者修改弹出的提示框
      rules: [
        {
          required: true,
          message: '请输入名称'
        }
      ]
    }
  },
  {
    title: '分类',
    name: 'classify',
    tableItem: {},
    dict: [{code: 1, codeName: "分类"},{code: 2, codeName: "标签"}],
    searchItem: {    //查询
      group: 'abc',
      type: 'select'  //she
    },
    formItem: {
      type: 'select',
      group: 'abc',
      rules: [
        {
          required: true,
          message: '请选择分类'
        }
      ]
    }
  },
  {
    title: '类型',
    name: 'type',
    tableItem: {},
  },
  {
    title: '排序',
    name: 'sort',
    tableItem: {},
  },
  {
    title: '操作',
    tableItem: {
      width: 100,
      fixed: 'right',
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit" />
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash" />
          </Button>
        </DataTable.Oper>
      )
    }
  }
];

export const DeliveryColumns = (self) => [
  {
    title: '快递公司',
    name: 'courier_company',
    formItem: {},
  },
  {
    title: '快递单号',
    name: 'tracking_number',
    formItem: {},
  }
];